<?php 

include_once "../config.php";

$username = $_POST['username']; 
$password = $_POST['password'];
// $username = $_post['username'];
// $password = $_post['password'];

// echo "username:".$username;
// echo "<br/>password:".$password;
// die;
$sql = "
select * from admin where username='$username' and
password='$password'
";


$result = $conn->query($sql);

if ($result->num_rows > 0) {  
	$rows = array();
	while($row = $result->fetch_assoc()) {
            array_push($rows, $row);        
    }
    
	session_start();
	$_SESSION['uid'] = $rows[0]['id'];
	$_SESSION['name'] = $rows[0]['username'];
    header("location:index.php");
}else {
	header("location:login.html");
}


?>